
/**
 * This singleton is used to debug the 'ewhiteboard' application.
 * @author eKameleon
 */
if ( ewhiteboard.logging.Logger == undefined ) 
{
	
	/**
	 * Creates a new Logger singleton.
	 */
	ewhiteboard.logging.Logger = {} ;

	/**
	 * Global Reference
	 */
	LOGGER = ewhiteboard.logging.Logger ;

	/**
	 * The application global logger id.
	 */
	LOGGER.APPLICATION_ID /*String*/ = "ewhiteboard" ;

	/**
	 * Logs the specified data using the LogEventLevel.DEBUG level.
	 * @param message:String The information to log. This string can contain special marker characters of the form {x}, where x is a zero based index that will be replaced with the additional parameters found at that index if specified.
 	 * @param ... rest Additional parameters that can be subsituted in the str parameter at each "{x}" location, where x is an integer (zero based) index value into the Array of values specified.
	 */
	LOGGER.debug = function (context) /*void*/ 
	{
		LOGGER._logger.debug.apply( LOGGER._logger, Array.fromArguments(arguments) ) ;
	}

	/**
	 * Logs the specified data using the LogEventLevel.ERROR level.
	 * @param message:String The information to log. This string can contain special marker characters of the form {x}, where x is a zero based index that will be replaced with the additional parameters found at that index if specified.
 	 * @param ... rest Additional parameters that can be subsituted in the str parameter at each "{x}" location, where x is an integer (zero based) index value into the Array of values specified.
	 */
	LOGGER.error = function (context) /*void*/
	{
		LOGGER._logger.error.apply( LOGGER._logger, Array.fromArguments(arguments) ) ;
	}

	/**
	 * Logs the specified data using the LogEventLevel.FATAL level.
	 * @param message:String The information to log. This string can contain special marker characters of the form {x}, where x is a zero based index that will be replaced with the additional parameters found at that index if specified.
 	 * @param ... rest Additional parameters that can be subsituted in the str parameter at each "{x}" location, where x is an integer (zero based) index value into the Array of values specified.	 
 	 */
	LOGGER.fatal = function (context) /*void*/
	{
		LOGGER._logger.fatal.apply( LOGGER._logger, Array.fromArguments(arguments) ) ;
	}

	/**
	 * Logs the specified data using the LogEvent.INFO level.
 	 * @param message:String The information to log. This string can contain special marker characters of the form {x}, where x is a zero based index that will be replaced with the additional parameters found at that index if specified.
 	 * @param ... rest Additional parameters that can be subsituted in the str parameter at each "{x}" location, where x is an integer (zero based) index value into the Array of values specified.
	 */
	LOGGER.info = function (context) /*void*/
	{
		LOGGER._logger.info.apply( LOGGER._logger, Array.fromArguments(arguments) ) ;
	}
	
	/**
	 * Initialize the global Logger singleton.
	 */
	LOGGER.initialize = function (context) /*void*/
	{
		
		var Log /*Function*/ = vegas.logging.Log ;
		var LogEventLevel /*Function*/ = vegas.logging.LogEventLevel ;
		
		var TraceTarget /*Function*/ = vegas.logging.targets.TraceTarget ;

		var traceTarget /*ITarget*/ = new TraceTarget() ;
		traceTarget.filters = [ LOGGER.APPLICATION_ID ] ;
		//traceTarget.includeDate = true ;
		//traceTarget.includeLevel = true ;
		traceTarget.includeLines = true ;
		//traceTarget.includeTime = true ;
		traceTarget.level = LogEventLevel.ALL ;
		
		Log.addTarget( traceTarget ) ; 
	}

	/**
	 * Logs the specified data at the given level.
	 * @param level:int The level this information should be logged at. Valid values are:
	 * <li>LogEventLevel.FATAL designates events that are very harmful and will eventually lead to application failure</li>
	 * <li>LogEventLevel.ERROR designates error events that might still allow the application to continue running.</li>
	 * <li>LogEventLevel.WARN designates events that could be harmful to the application operation</li>
	 * <li>LogEventLevel.INFO designates informational messages that highlight the progress of the application at coarse-grained level.</li>
	 * <li>LogEventLevel.DEBUG designates informational level messages that are fine grained and most helpful when debugging an application.</li>
	 * <li>LogEventLevel.ALL intended to force a target to process all messages.</li>
	 * @param message:String The information to log. This string can contain special marker characters of the form {x}, where x is a zero based index that will be replaced with the additional parameters found at that index if specified.
 	 * @param ... rest Additional parameters that can be subsituted in the str parameter at each "{x}" location, where x is an integer (zero based) index value into the Array of values specified.
 	 */
	LOGGER.log = function (level /*Number*/, context) /*void*/ 
	{
		LOGGER._logger.log.apply( LOGGER._logger, Array.fromArguments(arguments) ) ;
	}

	/**
	 * Logs the specified data using the LogEventLevel.WARN level.
 	 * @param message:String The information to log. This string can contain special marker characters of the form {x}, where x is a zero based index that will be replaced with the additional parameters found at that index if specified.
 	 * @param ... rest Additional parameters that can be subsituted in the str parameter at each "{x}" location, where x is an integer (zero based) index value into the Array of values specified.
	 */
	LOGGER.warn = function (context) /*void*/
	{
		LOGGER._logger.warn.apply( LOGGER._logger, Array.fromArguments(arguments) ) ;
	}

	/**
	 * The internal global logger of the application.
	 */
	LOGGER._logger /*ILogger*/ = vegas.logging.Log.getLogger( LOGGER.APPLICATION_ID ) ;


}